#pragma once
#include "GeoExport.h"

class Loop;
class Edge;
class Vertex;

enum HEdSign { PLUS, MINUS };

class HalfEdge {
public:
    HalfEdge() = default;
    ~HalfEdge() = default;

    HalfEdge* twin() const { return _twin; }
    void setTwin(HalfEdge* he) { _twin = he; }

    HalfEdge* next() const { return _next; }
    void setNext(HalfEdge* he) { _next = he; }

    HalfEdge* prev() const { return _prev; }
    void setPrev(HalfEdge* he) { _prev = he; }

    Loop* loop() const { return _loop; }
    void setLoop(Loop* loop) { _loop = loop; }

    Vertex* origin() const { return _origin; }
    void setOrigin(Vertex* v) { _origin = v; }

    Edge* edge() const { return _edge; }
    void setEdge(Edge* edge) { _edge = edge; }

private:
    HalfEdge* _twin = nullptr; // 对应的另一半边
    HalfEdge* _next = nullptr; // 下一个半边
    HalfEdge* _prev = nullptr; // 上一个半边

    Loop* _loop = nullptr;     // 所属环
    Edge* _edge = nullptr;     // 所属边
    Vertex* _origin = nullptr; // 半边起点
};